<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ctManagementLog.ascx.cs" Inherits="KhoaLuan.MainSys.Manager.Controls.ctManagementLog" %>

<link href="../../Style/modal.css" rel="stylesheet" />
<link href="../../Style/StyleCommon.css" rel="stylesheet" />
<script src="/Scripts/dluscript.js"></script>
<script type="text/javascript">
    var currentLog;

    var _listLog = [];

    function GetLogInList(id) {
        for (var i = 0; i < _listLog.length; i++) {
            if (_listLog[i].Id == id)
                return _listLog[i];
        }
        return null;
    }





    function LoadListLog(totalitem, target, listLog) {
        _listLog = listLog;
        debugger;
        target.empty();
        _listLog.forEach(function (item) {
            var tr = $("<tr>");
            var td = $("<td>").append($('<input type="checkbox">'));
            tr.append(td);
            td = $("<td>").text(item.Date);
            tr.append(td);
            td = $("<td>").text(item.Level);
            tr.append(td);
            td = $("<td>").text(item.Logger);
            tr.append(td);
            td = $("<td>").text(item.Message);
            tr.append(td);
            td = $("<td>").text(item.Exception);
            tr.append(td);
            td = $("<td>");

            tr.append(td);
            target.append(tr);
        });
    }
    function LoadData(page) {
        debugger;
        var numberinpage = 5;
        var keyword = $("#<%=txtTimKiem.ClientID%>").val();
        var dataagr = JSON.stringify({
            keyword: keyword,
            currentpage: parseInt(page),
            numberinpage: numberinpage
        });
        LoadDataWithPaging($("#tableLog > tbody"), $("#divpaging"), page, "POST", "/MainSys/ProcessAJAX/AjaxLog.aspx/GetListLog", dataagr, LoadListLog, numberinpage, LoadData);
    }

    $(document).ready(function () {
        debugger;
        LoadData(1);
    });


</script>
<div class="title">Log Manerger </div>

<div>
    <table id="Table1" style="border-collapse: collapse" cellpadding="0" width="100%" border="0">

        <tr>
            <td class="auto-style2" style="width: auto">
                <input type="button" id="btnHienThi" class="btnthem" runat="server" value="show" onclick="LoadTableLog()" />

                <asp:TextBox ID="txtTimKiem" runat="server"></asp:TextBox>
                <input type="button" id="btnTimKiem" class="btnthem" runat="server" value="Tim Kiem" onclick="LoadD()" />
        </tr>
        <tr>
            <td class="name_fild_row"></td>
        </tr>
        <tr>
            <td>

                <table id="tableLog" style="width: 100%; border: 1px solid gray">
                    <thead>
                        <tr>
                            <td></td>
                            <td>Date
                            </td>
                            <td>Level
                            </td>
                            <td>Logger
                            </td>
                            <td>Message
                            </td>
                            <td>Exception
                            </td>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
                <div id="divpaging"></div>
            </td>
        </tr>

    </table>
